package com.server.http.handler.impl;

import com.server.conditionenum.HttpReturnStatus;
import com.server.http.handler.HttpHandler;
import com.server.http.request.HttpRequestMessage;
import com.server.http.response.HttpResponseMessage;
import com.server.mine.net.HttpProtocol;
import com.server.tools.AppData;

/**
* @author	李小布
* @email	397554852@qq.com
* @version	创建时间：2018年9月29日 下午5:36:59
*/
public class BGGetRanklist extends HttpHandler{

	@Override
	public void handle(HttpRequestMessage request, HttpResponseMessage response) {
		String failMsg = null;
		int rkid = 0;
		try {
			rkid = Integer.parseInt(request.getParameter("rkid"));
		} catch (Exception e) {
			failMsg = "上传参数错误";
		}
		
		if(failMsg == null && AppData.rankDataMap.containsKey(rkid)) {
			SetReturnData(response,AppData.rankDataMap.get(rkid),HttpProtocol.BGGETRANKLIST,HttpReturnStatus.Successed);
			return;
		}else if(failMsg == null){
			failMsg = "该榜单不存在!";
		}
		SetReturnData(response,failMsg,HttpProtocol.BGGETRANKLIST,HttpReturnStatus.Failed);
	}
}